home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine CD 1995 / Archive Magazine CD 1995.iso / discs / prog_disc / volume_2 / issue_06 / fontaid / descrption next >
Encoding:
Text File  |  1989-02-13  |  15.6 KB  |  520 lines

  1. --  FFFFFFF                nn    --
  2. --  FF                     nn    -- 
  3. --  FF      oooo   nnnnn  nnnnn  --
  4. --  FFFFF  oo  oo  nn  nn  nn    --
  5. --  FF     oo  oo  nn  nn  nn    --
  6. --  FF     oo  oo  nn  nn  nn    --
  7. --  FF      oooo   nn  nn   nnn  --                   
  8.  
  9.                                                                     
  10.  DDDDD                         lll                    dd
  11.  DD  DD                         ll                    dd
  12.  DD   DD  oooo  ww   ww nnnnn   ll   oooo   aaaa   ddddd  eeee  rr rr
  13.  DD   DD oo  oo ww w ww nn  nn  ll  oo  oo     aa dd  dd ee  ee rrr rr
  14.  DD   DD oo  oo ww w ww nn  nn  ll  oo  oo  aaaaa dd  dd eeeeee rr
  15.  DD  DD  oo  oo wwwwwww nn  nn  ll  oo  oo aa  aa dd  dd ee     rr
  16.  DDDDD    oooo   ww ww  nn  nn llll  oooo   aaaaa  ddddd  eeee  rr
  17.  
  18.  
  19.  
  20. *****************************
  21.  
  22. (From Archive Volume 2 Number 6, published by Norwich Computer Services 
  23. Address: 18 Mile End Road, Norwich, NR4 7QY. Telephone: (0507) 507057)
  24.  
  25.  
  26. BBC Compatibility Column (1)
  27.  
  28. By Richard Averill
  29.  
  30. Welcome to the first BBC Compatibility Column! This is the forum for 
  31. any information exchange regarding the use of software / hardware from 
  32. Acorn computers such as the BBC model B or BBC Master. If you have 
  33. anything you feel would be applicable to this column, whether ideas or 
  34. large features, please send them to me via Paul at Norwich Computer 
  35. Services (see the address on the back cover of the magazine). We will 
  36. try to fit in as much as possible. If you are sending any discs, then 
  37. please send them in either an Acorn-format DFS, Solidisk double density 
  38. or an ADFS format, though please not the new RISC OS 'E' format!
  39.  
  40. This month we present an answer to the downloading of fonts. Coming up, 
  41. amongst other things, will be an in-depth discussion on all the various 
  42. BBC emulators for the Archimedes.
  43.  
  44. Font downloader
  45.  
  46. We have had many requests from Archimedes users for a way of 
  47. downloading fonts designed with the BBC FontAid package from CJE micros 
  48. (there is an Archimedes version available - see 'Fact File' on the 
  49. inside back cover). 
  50.  
  51. We present here a relocatable module to provide the *DLA command from 
  52. FontAid with a number of enhancements. This is only an update of a 
  53. small part of FontAid : the designer program and downloadable fonts for 
  54. FontAid appear only with FontAid as sold from CJE's, so this module 
  55. will not be of use to anyone not possessing FontAid. Existing BBC 
  56. FontAid users can transfer the fonts to the Archimedes with a suitable 
  57. DFS reader utility (try the Arc-DFS series on Archive Shareware Disc 2 
  58. - there will be an updated version with an on-line manual featuring on 
  59. a future shareware disc!)
  60.  
  61. Description
  62.  
  63. The module implements the command *DLA. On the BBC, this was a utility 
  64. that had to be loaded each time a font was required to be downloaded, 
  65. with the command *DLA <name of font file>. As the Archimedes has much 
  66. more memory, a relocatable module has been implemented that offers a 
  67. number of enhancements. 
  68.  
  69. In terms of speed, this module is anywhere upwards of 2 times the speed 
  70. of a BBC when downloading fonts (tested on one of our BBC model B's 
  71. fitted with a Solidisk 8271 DFS : other computers may be slower), with 
  72. this speed gained mainly from the fact that the font is loaded into RAM 
  73. before being sent to the printer, rather than using a byte get 
  74. operation. The main reason for the slow speed is the rate at which the 
  75. printer accepts the data.
  76.  
  77. The *DLA command can be used in the same way as originally, but the 
  78. command *DLA (without parameters) can be issued, if a font has been 
  79. previously downloaded, to download the previous font which will 
  80. hopefully still exist in the module's workspace. This is useful if 
  81. there are problems with the printer, or if the same font will be 
  82. downloaded more than once.
  83.  
  84. The use of proportional spacing for the fontaid fonts can improve the 
  85. look of the fonts a lot. This can be activated by adding the switch 'P' 
  86. (ie. just the character P) as the parameter directly after the *DLA. 
  87. For example, the following are all valid calls:
  88.  
  89. *DLA            : download previous font
  90. *DLA ThisFont   : download font file "ThisFont"
  91. *DLA P          : download previous font, set proportional spacing
  92. *DLA P ThisFont : download file "ThisFont", set proportional spacing
  93.  
  94. Technical details
  95.  
  96. To generate the module, RUN the program and enter the filename to save 
  97. the module under (the name "FontModule" will be used if none is given).
  98.  
  99. In response to the excellent comment from David Leckie (Archive 2.4, 
  100. page 4), here is a pseudo-code listing for the routine called by *DLA.
  101.  
  102. The listing is indented with control statements (eg. if/endif) enclosed 
  103. in brackets to separate them from other parts of the routine.
  104.  
  105. (line no's)
  106.  
  107. (600-620)   Exit if no workspace has been allocated for module.
  108. (660-670)   Check for 'P' switch:
  109.             (if set:)
  110. (750-780)     skip over blank spaces to next parameter
  111. (800-830)     send proportional spacing codes to printer :
  112.                 vdu 2,1,27,1,112,1,1,3 : see lines 1550-1580
  113.               decrement 'number of parameters variable'
  114.             (endif)
  115. (870-890)   Check 'number of parameters' variable:
  116.             (if equal to zero:) no font has to be downloaded
  117. (910-940)     Check to see if a font has been previously downloaded:
  118.               (if not:)
  119. (950)           make R0 point to error block
  120. (960-980)       load link reg (R14), set oVerflow bit, return to OS
  121.               (endif)
  122.             (if other than zero:) a font must be downloaded if possible
  123. (1020-1060)   find and allocate a handle to the named font file
  124.               (if file does not exist:)
  125. (1080-1120)     make R0 point to error block, set oVerflow, return
  126.               (endif)
  127. (1150-1210)   load file into workspace (See p244-250, PRM for OS_GBPB)
  128. (1230-1260)   set 'file previously downloaded' marker
  129.             (endif)
  130. (1280-1390) send ready - to - download control codes to printer :
  131.               see lines 1490-1530
  132. (1410-1520) send font file to printer, each byte prefixed by <1> code
  133.               : next code only sent to printer, not to screen driver.
  134.  
  135. Listing
  136.  
  137.    10 REM > DLASource
  138.    20 
  139.    30 REM Archimedes Font Downloader module
  140.    40 REM (for FontAid font files)
  141.    50 
  142.    60 REM (C) Richard Averill, January 1989.
  143.    70 
  144.    80 IF MODE <18 THEN MODE 0 ELSE MODE 18
  145.    90 PRINT TAB(15) "Archimedes FontAid font downloader module generator"'
  146.   100 PRINT TAB(25) "(C) Richard Averill, 1989."'
  147.   110 PRINT TAB(10) "(from Archive magazine, March 1989 (Volume 2 Number 6))"'
  148.   120 
  149.   130 DIM code% 4000
  150.   140 PROCassemble
  151.   150 INPUT "Filename to save module under (Return=""FontModule"") : " module$
  152.   160 IF module$="" THEN module$="FontModule"
  153.   170 SYS "OS_File",&0A,module$,&FFA,0,code%,O%
  154.   180 PRINT "Module saved as """;module$;""""
  155.   190 
  156.   200 END
  157.   210 
  158.   220 DEF PROCassemble
  159.   230 XWriteI%=&20100
  160.   240 FOR opt%=4 TO 6 STEP 2
  161.   250   P%=0:O%=code%
  162.   260   [ OPT opt%
  163.   270   EQUD  0
  164.   280   EQUD  ptrinit
  165.   290   EQUD  0
  166.   300   EQUD  0
  167.   310   EQUD  strtitle
  168.   320   EQUD  strhelp
  169.   330   EQUD  tblcommands
  170.   340   EQUS  STRING$(20,CHR$(0))
  171.   350   
  172.   360   .strtitle FNstr("FontDownLoader")
  173.   370   
  174.   380   .strhelp FNstr("FontDownLoader"+CHR$(9)+"1.00 ("+MID$(TIME$,5,11)+") (C)
  175.  Richard Averill, January 1989.")
  176.   390   
  177.   400   .ptrinit
  178.   410   STMFD R13!, {R14}
  179.   420   
  180.   430   MOV   R0, #6
  181.   440   MOV   R3, #8192
  182.   450   SWI   "XOS_Module"
  183.   460   
  184.   470   BVS   init_exit
  185.   480   
  186.   490   STR   R2, [R12]
  187.   500   MOV   R0, #0
  188.   510   ADD   R2, R2, #7168
  189.   520   STR   R0, [R2]
  190.   530   
  191.   540   SWI   "XOS_WriteS"
  192.   550   FNnla("Font-DownLoader v1.00 (C) Richard Averill, January 1989, installe
  193. d.")
  194.   560   
  195.   570   .init_exit LDMFD R13!, {PC}
  196.   580   
  197.   590   .dla
  198.   600   LDR   R2, [R12]
  199.   610   CMP   R2, #0
  200.   620   MOVEQS PC, R14
  201.   630   
  202.   640   STMFD R13!, {R14}
  203.   650   STMFD R13!, {R2}
  204.   660   LDRB  R2, [R0]
  205.   670   TST   R2, #&20
  206.   680   BICEQ R2, R2, #&20
  207.   690   CMP   R2, #ASC"P"
  208.   700   BNE   not_proportional
  209.   710   LDRB  R2, [R0, #1]
  210.   720   CMP   R2, #32
  211.   730   BGT   not_proportional
  212.   740   
  213.   750   .jumpover_loop
  214.   760   LDRB  R2, [R0], #1
  215.   770   CMP   R2, #32
  216.   780   BLE   jumpover_loop
  217.   790   
  218.   800   STMFD R13!, {R0}
  219.   810   ADR   R0, proportional_codes
  220.   820   SWI   "XOS_Write0"
  221.   830   LDMFD R13!, {R0}
  222.   840   SUB   R1, R1, #1
  223.   850   
  224.   860   .not_proportional
  225.   870   LDMFD R13!, {R2}
  226.   880   CMP   R1, #0
  227.   890   BNE   havetoload
  228.   900   
  229.   910   LDR   R2, [R12]
  230.   920   ADD   R2, R2, #7168
  231.   930   LDR   R2, [R2]
  232.   940   CMP   R2, #0
  233.   950   ADREQ R0, msg_nofont
  234.   960   LDMEQFD R13!, {R14}
  235.   970   ORREQ R14, R14, #(1<<28)
  236.   980   MOVEQS PC, R14
  237.   990   B     download
  238.  1000   
  239.  1010   .havetoload
  240.  1020   MOV   R1, R0
  241.  1030   MOV   R0, #&40
  242.  1040   MOV   R2, #0
  243.  1050   
  244.  1060   SWI   "XOS_Find"
  245.  1070   
  246.  1080   CMP   R0, #0
  247.  1090   ADREQ R0, msg_nofont
  248.  1100   LDMEQFD R13!, {R14}
  249.  1110   ORREQ R14, R14, #(1<<28)
  250.  1120   MOVEQS  PC, R14
  251.  1130   
  252.  1140   .file_found
  253.  1150   MOV   R1, R0
  254.  1160   MOV   R0, #3
  255.  1170   LDR   R2, [R12]
  256.  1180   MOV   R3, #6144
  257.  1190   MOV   R4, #0
  258.  1200   
  259.  1210   SWI   "XOS_GBPB"
  260.  1220   
  261.  1230   MOV   R0, #1
  262.  1240   LDR   R1, [R12]
  263.  1250   ADD   R1, R1, #7168
  264.  1260   STR   R0, [R1]
  265.  1270   
  266.  1280   .download
  267.  1290   SWI   XWriteI%+2
  268.  1300   
  269.  1310   ADR   R1, pre_dla
  270.  1320   ADD   R2, R1, #14
  271.  1330   .pre_loop
  272.  1340   LDRB  R0, [R1], #1
  273.  1350   SWIVC XWriteI%+1
  274.  1360   SWIVCS  "XOS_WriteC"
  275.  1370   BVS   dlaexit
  276.  1380   CMP   R1, R2
  277.  1390   BLT   pre_loop
  278.  1400   
  279.  1410   LDR   R1, [R12]
  280.  1420   ADD   R2, R1, #6144
  281.  1430   .dla_loop
  282.  1440   LDRB  R0, [R1], #1
  283.  1450   SWIS  XWriteI%+1
  284.  1460   SWIVCS "XOS_WriteC"
  285.  1470   BVS   dlaexit
  286.  1480   CMP   R1, R2
  287.  1490   BLT   dla_loop
  288.  1500   
  289.  1510   .dlaexit
  290.  1520   SWI   XWriteI%+3
  291.  1530   LDMFD R13!, {PC}
  292.  1540   
  293.  1550   .pre_dla EQUD  &251B281B : EQUD &521B0001 : EQUD &261B00 : EQUD &7F00
  294.  1560   
  295.  1570   .proportional_codes EQUD  &011B0102 : EQUD &03010170 : EQUD 0
  296.  1580   
  297.  1590   .msg_nofont
  298.  1600   EQUD  &D6 : FNstr("Font file not found")
  299.  1610   
  300.  1620   .tblcommands
  301.  1630   FNstr("DLA")
  302.  1640   EQUD  dla : EQUD &20100 : EQUD syndla : EQUD hlpdla : EQUD 0
  303.  1650   
  304.  1660   .hlpdla
  305.  1670   EQUS  "Font-DownLoader, (C) Richard Anthony Averill, January 1989."+CHR$
  306. (13)+CHR$(13)
  307.  1680   EQUS  "*DLA downloads FontAid font files to Canon-type NLQ printers."+CH
  308. R$(13)
  309.  1690   EQUS  "The P prefix, when present, causes proportional spacing to be ena
  310. bled."+CHR$(13)
  311.  1700   EQUS "If no font file is given, the previous downloaded font will be re-
  312. downloaded."+CHR$(13)
  313.  1710   .syndla
  314.  1720   FNstr("Syntax: *DLA [P] [<font file>].")
  315.  1730   ]
  316.  1740 NEXT opt%
  317.  1750 ENDPROC
  318.  1760 
  319.  1770 DEF FNstr(str$)
  320.  1780 [ OPT opt% AND &E
  321.  1790 EQUS str$ + CHR$(0)
  322.  1800 ALIGN
  323.  1810 ] :=opt%
  324.  1820 
  325.  1830 DEF FNnla(str$)
  326.  1840 [ OPT opt% AND &E
  327.  1850 EQUS str$ + CHR$(10) + CHR$(13) + CHR$(0)
  328.  1860 ALIGN
  329.  1870 ] :=opt%
  330.  
  331. Listing
  332.  
  333.    10 REM > DLASource
  334.    20 
  335.    30 REM Archimedes Font Downloader module
  336.    40 REM (for FontAid font files)
  337.    50 
  338.    60 REM (C) Richard Averill, January 1989.
  339.    70 
  340.    80 IF MODE <18 THEN MODE 0 ELSE MODE 18
  341.    90 PRINT TAB(15) "Archimedes FontAid font downloader module generator"'
  342.   100 PRINT TAB(25) "(C) Richard Averill, 1989."'
  343.   110 PRINT TAB(10) "(from Archive magazine, March 1989 (Volume 2 Number 6))"'
  344.   120 
  345.   130 DIM code% 4000
  346.   140 PRINT "Assembling code ...";:PROCassemble:PRINT '
  347.   150 INPUT "Filename to save module under (Return=""FontModule"") : " module$
  348.   160 IF module$="" THEN module$="FontModule"
  349.   170 SYS "OS_File",&0A,module$,&FFA,0,code%,O%
  350.   180 PRINT "Module saved as """;module$;""""
  351.   190 
  352.   200 END
  353.   210 
  354.   220 DEF PROCassemble
  355.   230 sp=13 : link=14 : pc=15:XWriteI%=&20100
  356.   240 FOR opt%=4 TO 6 STEP 2
  357.   250   P%=0:O%=code%
  358.   260   [ OPT opt%
  359.   270   equd    0
  360.   280   equd    ptrinit
  361.   290   equd    0
  362.   300   equd    0
  363.   310   equd    strtitle
  364.   320   equd    strhelp
  365.   330   equd    tblcommands
  366.   340   equs    STRING$(20,CHR$(0))
  367.   350   
  368.   360   .strtitle FNstr("FontDownLoader")
  369.   370   
  370.   380   .strhelp FNstr("FontDownLoader"+CHR$(9)+"1.00 ("+MID$(TIME$,5,11)+") (C) Richard Averill, January 1989.")
  371.   390   
  372.   400   .ptrinit
  373.   410   stmfd   (sp)!, {link}
  374.   420   
  375.   430   mov     r0, #6
  376.   440   mov     r3, #8192
  377.   450   swi     "XOS_Module"
  378.   460   
  379.   470   bvs     init_exit
  380.   480   
  381.   490   str     r2, [r12]
  382.   500   mov     r2, #0
  383.   510   add     r2, r2, #7168
  384.   520   str     r0, [r2]
  385.   530   
  386.   540   swi     "XOS_WriteS"
  387.   550   FNnla(  "Font-DownLoader v1.00 (C) Richard Averill, January 1989, installed.")
  388.   560   
  389.   570   .init_exit ldmfd (sp)!, {pc}
  390.   580   
  391.   590   .dla
  392.   600   ldr     r2, [r12]
  393.   610   cmp     r2, #0
  394.   620   moveqs  pc, link
  395.   630   
  396.   640   stmfd   (sp)!, {link}
  397.   650   stmfd   (sp)!, {r2}
  398.   660   ldrb    r2, [r0]
  399.   670   tst     r2, #&20
  400.   680   biceq   r2, r2, #&20
  401.   690   cmp     r2, #ASC("P")
  402.   700   bne     not_proportional
  403.   710   ldrb    r2, [r0, #1]
  404.   720   cmp     r2, #32
  405.   730   bgt     not_proportional
  406.   740   
  407.   750   .jumpover_loop
  408.   760   ldrb    r2, [r0], #1
  409.   770   cmp     r2, #32
  410.   780   ble     jumpover_loop
  411.   790   
  412.   800   stmfd   (sp)!, {r0}
  413.   810   adr     r0, proportional_codes
  414.   820   swi     "XOS_Write0"
  415.   830   ldmfd   (sp)!, {r0}
  416.   840   sub     r1, r1, #1
  417.   850   
  418.   860   .not_proportional
  419.   870   ldmfd   (sp)!, {r2}
  420.   880   cmp     r1, #0
  421.   890   bne     havetoload
  422.   900   
  423.   910   ldr     r2, [r12]
  424.   920   add     r2, r2, #7168
  425.   930   ldr     r2, [r2]
  426.   940   cmp     r2, #0
  427.   950   adreq   r0, msg_nofont
  428.   960   ldmeqfd (sp)!, {link}
  429.   970   orreq   link, link, #(1<<28)
  430.   980   moveqs  pc, link
  431.   990   b       download
  432.  1000   
  433.  1010   .havetoload
  434.  1020   mov     r1, r0
  435.  1030   mov     r0, #&40
  436.  1040   mov     r2, #0
  437.  1050   
  438.  1060   swi     "XOS_Find"
  439.  1070   
  440.  1080   cmp     r0, #0
  441.  1090   adreq   r0, msg_nofont
  442.  1100   ldmeqfd (sp)!, {link}
  443.  1110   orreq   link, link, #(1<<28)
  444.  1120   moveqs  pc, link
  445.  1130   
  446.  1140   .file_found
  447.  1150   mov     r1, r0
  448.  1160   mov     r0, #3
  449.  1170   ldr     r2, [r12]
  450.  1180   mov     r3, #6144
  451.  1190   mov     r4, #0
  452.  1200   
  453.  1210   swi     "XOS_GBPB"
  454.  1220   
  455.  1230   mov     r0, #1
  456.  1240   ldr     r1, [r12]
  457.  1250   add     r1, r1, #7168
  458.  1260   str     r0, [r1]
  459.  1270   
  460.  1280   .download
  461.  1290   swi     XWriteI%+2
  462.  1300   
  463.  1310   adr     r1, pre_dla
  464.  1320   add     r2, r1, #14
  465.  1330   .pre_loop
  466.  1340   ldrb    r0, [r1], #1
  467.  1350   swivc   XWriteI%+1
  468.  1360   swivcs  "XOS_WriteC"
  469.  1370   bvs     dlaexit
  470.  1380   cmp     r1, r2
  471.  1390   blt     pre_loop
  472.  1400   
  473.  1410   ldr     r1, [r12]
  474.  1420   add     r2, r1, #6144
  475.  1430   .dla_loop
  476.  1440   ldrb    r0, [r1], #1
  477.  1450   swis    XWriteI%+1
  478.  1460   swivcs  "XOS_WriteC"
  479.  1470   bvs     dlaexit
  480.  1480   cmp     r1, r2
  481.  1490   blt     dla_loop
  482.  1500   
  483.  1510   .dlaexit
  484.  1520   swi     XWriteI%+3
  485.  1530   LDMFD   (sp)!, {pc}
  486.  1540   
  487.  1550   .pre_dla equd  &251B281B : equd &521B0001 : equd &261B00 : equd &7F00
  488.  1560   
  489.  1570   .proportional_codes equd  &011B0102 : equd &03010170 : equd 0
  490.  1580   
  491.  1590   .msg_nofont
  492.  1600   equd  &D6 : FNstr("Font file not found")
  493.  1610   
  494.  1620   .tblcommands
  495.  1630   FNstr("DLA")
  496.  1640   equd  dla : equd &20100 : equd syndla : equd hlpdla : equd 0
  497.  1650   
  498.  1660   .hlpdla
  499.  1670   equs  "Font-DownLoader, (C) Richard Anthony Averill, January 1989."+CHR$(13)+CHR$(13)
  500.  1680   equs  "*DLA downloads FontAid font files to Canon-type NLQ printers."+CHR$(13)
  501.  1690   equs  "The P prefix, when present, causes proportional spacing to be enabled."+CHR$(13)
  502.  1700   equs "If no font file is given, the previous downloaded font will be re-downloaded."+CHR$(13)
  503.  1710   .syndla
  504.  1720   FNstr("Syntax: *DLA [P] [<font file>].")
  505.  1730   ]
  506.  1740 NEXT opt%
  507.  1750 ENDPROC
  508.  1760 
  509.  1770 DEF FNstr(str$)
  510.  1780 [ OPT opt% AND &E
  511.  1790 equs    str$ + CHR$(0)
  512.  1800 align
  513.  1810 ] :=opt%
  514.  1820 
  515.  1830 DEF FNnla(str$)
  516.  1840 [ OPT opt% AND &E
  517.  1850 equs    str$ + CHR$(10) + CHR$(13) + CHR$(0)
  518.  1860 align
  519.  1870 ] :=opt%
  520.